package com.zhima.frame;

import com.zhima.panel.RandomInDataConfiguration;
import com.zhima.task.PreviewInDataSupplier;

import javax.swing.*;
import java.awt.*;
import java.util.List;

public class PreviewInDataFrame extends JFrame {

    public PreviewInDataFrame(List<RandomInDataConfiguration> randomInDataConfigurations) throws HeadlessException {
        super("预览In数据生成");
        setBounds(50, 200, 500, 500);
        setAlwaysOnTop(true);
        JTextArea showPreviewInDataJTextArea = new JTextArea();
        JScrollPane previewInDataJScrollPane = new JScrollPane(showPreviewInDataJTextArea);
        showPreviewInDataJTextArea.setText(new PreviewInDataSupplier(randomInDataConfigurations).get());
        add(new JLabel("按照配置规则生成的一次随机数据如下："), BorderLayout.NORTH);
        add(previewInDataJScrollPane, BorderLayout.CENTER);
    }
}
